﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations.Schema;

namespace S4Store.Domain.CommonSellerKpi
{
    public  class CommonSellerMonthConfig
    {
        public int Id { get; set; }

        /// <summary>
        /// 是否确认
        /// </summary>
        public bool IsConfirmed { get; set; }
        /// <summary>
        /// 月
        /// </summary>
        public DateTime Month { get; set; }


        public int SellerId { get; set; }

        /// <summary>
        /// 销售目标
        /// </summary>
        public int SaleTarget { get; set; }

        /// <summary>
        /// 月初意向客户数
        /// </summary>
        public int LastMonthPotentialClient { get; set; }


        public virtual Employee Seller { get; set; }


        public int CarBrandId { get; set; }


        public virtual CarBrand CarBrand { get; set; }
        /// <summary>
        /// 首   次   来   店     登   记   数  目  标
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public int GetSCLDDJMB(CommonSellerKpiMonthConfig config)
        {
            if(config==null||config.LastMonthAvgvr==0)
            {
                return 0;
            }
            return (int)(SaleTarget*100/config.LastMonthAvgvr);
        }
    }
}
